From 2b1e704734e09cb2b778146bce9111123f822bbe Mon Sep 17 00:00:00 2001 From: "kaf24@localhost.localdomain" Date: Mon, 28 Aug 2006 12:50:55 +0100 Subject: [PATCH] The following patch fixes a bug where xenconsoled will can SEGV because it uses FD_ISSET(-1,xxx). Since the code is written that any ring/tty handler can set d->tty_fd to -1 it has to be checked _every_time_. Signed-off-by: Jimi Xenidis --- tools/console/daemon/io.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index 5c0eaa0d9d..93f96b101d 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -584,16 +584,14 @@ void handle_io(void) FD_ISSET(xc_evtchn_fd(d->xce_handle), &readfds)) handle_ring_read(d); - if (d->tty_fd != -1) { - if (FD_ISSET(d->tty_fd, &readfds)) - handle_tty_read(d); + if (d->tty_fd != -1 && FD_ISSET(d->tty_fd, &readfds)) + handle_tty_read(d); - if (FD_ISSET(d->tty_fd, &writefds)) - handle_tty_write(d); + if (d->tty_fd != -1 && FD_ISSET(d->tty_fd, &writefds)) + handle_tty_write(d); - if (d->is_dead) - cleanup_domain(d); - } + if (d->is_dead) + cleanup_domain(d); } } while (ret > -1); } -- 2.30.2